import os, time, random

FILE = 'cube.blend'
SCRIPT = './move.py'
DIR = 'data'
LOG = 'samples'

axes = {}
axes[0] = 'X'
axes[1] = 'Y'
axes[2] = 'Z'

RANGED = 2.5
RANGER = 0.5
SAMPLES = 36

for i in range (0, SAMPLES):

    dx = random.Random().uniform(-RANGED, RANGED)
    dy = random.Random().uniform(-RANGED, RANGED)
    dz = random.Random().uniform(-RANGED, RANGED)

    rx = random.Random().uniform(-RANGER, RANGER)
    ry = random.Random().uniform(-RANGER, RANGER)
    rz = random.Random().uniform(-RANGER, RANGER)

    f = open(os.path.join(DIR, LOG), 'a')
    filename = 'sample' + str(random.Random().randint(0, 1000000))
    f.write(filename + ':')
    f.close()

    os.system('blender -b ' + os.path.join(DIR, FILE) + ' -P ' + SCRIPT + ' -f 1 ' + str(dx) + ' ' + str(dy) + ' ' + str(dz) + ' ' + str(rx) + ' ' + str(ry) + ' ' + str(rz))
    os.system('mv /tmp/0001.png ' + os.path.join(DIR, filename))
